// packageB/pages/package/topic_manage/add_manage/add.js
const mybehavior = require("../../../../behaviors/requests")
Page({

  /**
   * 页面的初始数据
   */
  behaviors: [mybehavior],
  data: {
    active: "0",
    task_count: 10,
    sqd_total: 0,
    sqd_arr: [],
    total1: 0,
    total: 0,
    list1: "",
    show1: true,
  },
  onChange(event) {
    console.log(event);
    this.setData({
      active: event.detail.name,
    });
    if (event.detail.name == "a") {
      wx.redirectTo({
        url: '/packageB/pages/package/topic_manage/add_manage/add'
      })
    }
  },


  onRefresh: function () {
    //导航条加载动画
    wx.showNavigationBarLoading()
    //loading 提示框
    wx.showLoading({
      title: '刷新中...',
    })
    if (this.data.active == "1") {
      let childObj1 = this.selectComponent('.my-component1')
      childObj1.filterResetBtn()

    }
    if (this.data.active == "2") {
      let childObj2 = this.selectComponent('.my-component2')
      childObj2.filterResetBtn()

    }
    if (this.data.active == "0") {
      let childObj0 = this.selectComponent('.my-component0')
      childObj0.filterResetBtn()

    }
    console.log("下拉刷新啦");
    setTimeout(function () {
      wx.hideLoading();

      wx.hideNavigationBarLoading();
      //停止下拉刷新
      wx.stopPullDownRefresh();
    }, 2000)
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {


  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {


  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
    this.onRefresh()


  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    if (this.data.active == undefined) {
      this.setData({
        active: "0"
      })
    }
    if (this.data.active == "1") {
      let childObj1 = this.selectComponent('.my-component1')
      childObj1.updateData()

    }
    if (this.data.active == "2") {
      let childObj2 = this.selectComponent('.my-component2')
      childObj2.updateData()

    }
    if (this.data.active == "0") {
      let childObj0 = this.selectComponent('.my-component0')
      childObj0.updateData()

    }





  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})